package com.student;

import java.sql.Connection;
import java.sql.DriverManager;

import com.student.util.Util;

public class DBConn {
	public static Connection getConn() {
		Connection conn = null;
		try {
			Class.forName("com.mysql.jdbc.Driver");
			String url = "jdbc:mysql://localhost:3306/shop?user=root&password=liwentao";
			// 针对本地调试还是发布版本设置的，发布版本的服务器位于sae.sina.com.cn
			if (Util.isSAE) {
				url = "jdbc:mysql://w.rdc.sae.sina.com.cn:3307/app_studentstreetbs?user=15lwy2l32x&password=mwj42yi3z03xzly3y1lx5ywxl4m152kj52ihy14z";
			}
			conn = DriverManager.getConnection(url);
			return conn;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return conn;
	}
}
